<?php

class GameboardView extends dmq\View
{
	public function buildGameboard()
	{
		$this->Markup( '        <div id="gameboard">' . "\r\n" );
		$this->Markup( '          <div id="staticEffects" class="staticEffect" >' . "\r\n" );
		$this->Markup( '          </div>' . "\r\n" );
		$this->Markup( '          <div id="effects" class="effect" >' . "\r\n" );
		$this->Markup( '          </div>' . "\r\n" );
		$this->Markup( '          <div id="robots" class="robot">' . "\r\n" );
		$this->Markup( '          </div>' . "\r\n" );
		$this->Markup( '          <div id="win" class="win"></div>' . "\r\n" );
		$this->Markup( '        </div>' . "\r\n" );

		$this->Markup( '        <div id="gameInput">' . "\r\n" );
		$this->Markup( '          <div id="robotStatus"></div>' . "\r\n" );
		$this->Markup( '          <div id="registers"></div>' . "\r\n" );
		$this->Markup( '          <div id="hand"></div>' . "\r\n" );
		$this->Markup( '          <div id="ready"></div>' . "\r\n" );
		$this->Markup( '        </div>' . "\r\n" );
	}

	public function gameId()
	{
		return isset( $_GET['game'] ) && preg_match( '/^[0-9]+$/', $_GET['game'] ) ? $_GET['game'] : null;
	}

	public function registerCards()
	{
		$cards = array();

		for ( $i = 0; $i <= 4; $i++ )
		{
			$cards[] = isset( $_POST['register' . $i] ) && preg_match( '/^[0-9]+$/', $_POST['register' . $i] ) ? $_POST['register' . $i] : null;
		}
		
		return $cards;
	}
}
